-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EEM] Replace hashed ID with human readable ID #193652
[EEM] Replace hashed ID with human readable ID #193652
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
/ci |
...ck/plugins/entity_manager/server/lib/entities/ingest_pipeline/generate_history_processors.ts
Outdated
Show resolved
Hide resolved
value: definition.identityFields | ||
.map((identityField) => { | ||
const field = `entity.identity.${identityField.field}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we sort the identityFields to make sure it is consistent even if the order of identityFields for whatever reason changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the pr desc mentions this but looks like it's not implemented yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one problem I see with this is that any consumer of the definition must then also remember to sort the fields first before recreating the ID.
While if we rely on the order of definition, it is up to the author to ensure the order makes sense as the set of fields changes.
Could it be that it's a valid case to change the order of the fields?
It should not have any semantic meaning, but may lead to "prettier" IDs being generated depending on the values found in the used fields.
In a world where we don't do materialization (by default), this seems like a smaller problem?
We did have some discussion recently where we said that essentially, if you change the identity fields, we should just throw away any previously materialized data as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can expose utility methods that convert the id into an entity, and given that, I would personally prefer sorting the identity fields because we can sort it always when we deserialize, instead of hoping no one changed the order of the identity fields (for whatever reason).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a world where interactions go through an entities client, that should be fine, I'll add the sorting then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an issue for this: https://github.com/orgs/elastic/projects/1504/views/1?filterQuery=id&pane=issue&itemId=82919655
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
8cc989a
to
9c3997d
Compare
bf3fe56
to
9afd5ad
Compare
@@ -145,7 +145,7 @@ export type MetadataField = z.infer<typeof metadataSchema>; | |||
export const identityFieldsSchema = z | |||
.object({ | |||
field: z.string(), | |||
optional: z.boolean(), | |||
optional: z.literal(false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blocks people from using optional fields even though technically this is still supported in the code, and we transform the existing saved objects to remove them.
This is mainly due to not being able to change the saved object mapping.
EntityDefinition, | ||
EntityDefinition | ||
> = (savedObject) => { | ||
// Doing only this may break displayNameTemplates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which I think is okay since we're likely to remove this anyway in the future since it's hard to do any kind of template in ES|QL at runtime. So the displayNameTemplate might become similar to the identity field, where we just let users decide which fields to concat instead.
… src/core/server/integration_tests/ci_checks'
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe transform LGTM.
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11405848322 |
This PR turns the `entity.id` field format from a hashed value to a human readable string of the **values** found in the identity fields, such as `my_host-my_cloud_zone` for the identity fields `[host.name, cloud.availability_zone]`. The order of the values is based on the order in the identity fields list. --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit ae2c6ad)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[EEM] Replace hashed ID with human readable ID (#193652)](#193652) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-18T14:42:38Z","message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Feature:EEM"],"title":"[EEM] Replace hashed ID with human readable ID","number":193652,"url":"https://github.com/elastic/kibana/pull/193652","mergeCommit":{"message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193652","number":193652,"mergeCommit":{"message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"}}]}] BACKPORT--> Co-authored-by: Milton Hultgren <[email protected]>
This PR turns the `entity.id` field format from a hashed value to a human readable string of the **values** found in the identity fields, such as `my_host-my_cloud_zone` for the identity fields `[host.name, cloud.availability_zone]`. The order of the values is based on the order in the identity fields list. --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit ae2c6ad)
) # Backport This will backport the following commits from `main` to `8.16`: - [EEM] Replace hashed ID with human readable ID (#193652) (ae2c6ad) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-18T14:42:38Z","message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}] BACKPORT--> Co-authored-by: Milton Hultgren <[email protected]>
This PR turns the
entity.id
field format from a hashed value to a human readable string of the values found in the identity fields, such asmy_host-my_cloud_zone
for the identity fields[host.name, cloud.availability_zone]
.The order of the values is based on the order in the identity fields list.